using System.Configuration;
using System.Security.Cryptography.X509Certificates;

namespace NHConfiguration
{
    public class EndPointElement : ConfigurationElement
    {
        [ConfigurationProperty("contract", IsRequired = true)]
        public string Contract
        {
            get { return (string)this["contract"]; }
            set { this["contract"] = value; }
        }

        [ConfigurationProperty("clientCertificate", IsRequired = false)]
        public string ClientCertificate
        {
            get { return (string)this["clientCertificate"]; }
            set { this["clientCertificate"] = value; }
        }

        public X509Certificate2 GetClientCertificate()
        {
            return CertificateHelper.LoadFromFile(ClientCertificate);
        }
    }
}